import xml.etree.ElementTree as ET
tree=ET.parse('d:\\download\\update.xml')
root=tree.getroot()
#root=ET.fromstring('letter')
#print(root.tag)
####https://docs.lvrui.io/2016/06/22/python%E5%A4%84%E7%90%86XML%E6%96%87%E4%BB%B6/
#print(root.text)
bigNode=[]
bigNodeText=[]
#for node in root:
#    bigNode.append(node.tag)
#    bigNodeText.append(node.text)
#print(bigNode)
#for i in range(len(bigNode)):
    #print('('+str(i)+'):'+str(bigNode[i])+'-->'+str(bigNodeText[i]))
#bigNodeText[9]='www.badallen.com'
#node=root.iter("weblink")
#for i in root.iter():
#    print(i.tag)
    #node.set("badallen ","1111")
#node.text='1badallen.com'

for node in root.iter('rank'):
    #print(node.tag,node.attrib)
    print(node.text)
    node.text='5688'
for node in root.iter('year'):
    #print(node.tag,node.attrib)
    print(node.text)
    node.text='2399'






tree =ET.ElementTree(root)
tree.write("d:\\download\\update.xml",encoding='utf-8')